<% 
	var headContent = {
	include("/pages/template/head.html"){}
%>

<script type="text/javascript">
var oper ;
jQuery(function($) {
	oper = new flyfox("@{crud.urlKey}", "@{crud.name}");
	oper.height = @{crud.editMap.~size} * 60 + 90; // 重设高度
	if(oper.height < 300) oper.height = 300;
	if(oper.height > 500) oper.height = 500;
	paginator = function(page) {
		oper.list();
	};

	//显示Menu索引
	showMenu('page_@{crud.urlKey}');
});
</script>

<%
};

var bodyContent = {
%>
	<form name="form1" action="" method="post"  class="form-inline" role="form">
		<!-- 菜单 -->
		<% include("/static/component/include/menu.html"){} %>

		<div class="tableSearch">
			<%  //查询列表 %>
	# for(entry in crud.searchMap){ #
			#
			var key = entry.value.key;
			var name = 'attr.'+entry.value.key;
			var data = flyfox.dataList(entry.value.formTypeData); 
			#
			<div class="form-group">
			#if (entry.value.formType=="INPUT") {#
				# if (entry.value.inputType=='TEXT') { #
					<input class="form-control" type="text" name="@{name}" value="${@{name}!''}" 
						placeholder="请输入@{entry.value.name}" @{!strutils.isEmpty(entry.value.formTypeValid)?entry.value.formTypeVaild:'' } />
				# } else if (entry.value.inputType=='RADIO') { #
					<select name="@{name}" class="form-control" >
					<option value="-1">--请选择--</option>
					# layout("util/select.html",{obj:data,name:name}){ } #
					</select>
				# } else if (entry.value.inputType=='CHECKBOX') { #
					<select name="@{name}" class="form-control" >
					<option value="-1">--请选择--</option>
					# layout("util/select.html",{obj:data,name:name}){ } #
					</select>
				# } else { #
					<input class="form-control" type="@{entry.value.inputType}" name="@{name}" value="${@{name}}"
						placeholder="请输入@{entry.value.name}" @{entry.value.formTypeVaild } />
				# } #
			# } else if (entry.value.formType=='TEXTAREA') { #
				<input class="form-control" type="text" name="@{name}" value="${@{name}!''}"
					placeholder="请输入@{entry.value.name}" @{entry.value.formTypeVaild } />
			# }  else if (entry.value.formType=='DICT') { #
				<select name="@{name}" class="form-control" >
				<option value="-1">--请选择--</option>
				${flyfox.dictSelect('@{entry.value.formTypeData}' , @{name}!'')  }
				</select>
			# }  else if (entry.value.formType=='SELECT') { #
				<select name="@{name}" class="form-control" >
				<option value="-1">--请选择--</option>
				# layout("util/select.html",{obj:data,name:name}){ } #
				</select>
			# }#
			</div>
	# }#
			
			<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			 		<span class="glyphicon glyphicon-search"></span> 查 询
			</button>
			<button type="button" class="btn btn-default" onclick="resetForm();">
			 		<span class="glyphicon glyphicon-refresh"></span> 重 置
			</button>
			<button type="button" class="btn btn-default" onclick="oper.add();">
			 		<span class="glyphicon glyphicon-plus"></span> 新 增
			</button>
		</div>
		
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
# for(entry in crud.listMap){ #
					<th>@{entry.value.name}</th> 
# } # 
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<% for(item in page.list){ %>
				<tr>
				<td>${itemLP.index }</td>
					<%  // 列表内容 %>
	# 
	for(entry in crud.listMap){  
		var key = entry.value.key;
		var name = 'item.'+entry.value.key;
		var data = flyfox.dataList(entry.value.formTypeData); 
	#
		#	
		if (entry.value.formType=="TEXTAREA") {
		#
				<td title="${@{name}}">
				<% if (strutil.length(@{name}) > 6) { %>
					${strutil.subStringTo(@{name}, 0, 6)}...
				<% 	} else { %>
					${@{name}}
				<%  } %>
				</td> 
		#  } else if (entry.value.formType=="INPUT") { #
		#	if (entry.value.inputType=='TEXT') { #
			<td>${@{name}}</td> 
			# } else if (entry.value.inputType=='RADIO') { #
				<td>
				# layout("util/value.html",{obj:data,name:name}){ }  #
				</td>  
			# } else if (entry.value.inputType=='CHECKBOX') { #
				<td>
				# layout("util/value.html",{obj:data,name:name}){ }  #
				</td> 
			# } else { #
				<td>${@{name}}</td>
			# } #
		# }  else if (entry.value.formType=='DICT') { #
				<td>${flyfox.dictValue(@{name}!'' )  }</td>
		# }  else if (entry.value.formType=='SELECT') {  #
				<td>
				# layout("util/value.html",{obj:data,name:name}){ }  #
				</td> 
		# }#
	# } #
				<td>
				<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${item.@{crud.primaryKey}});">查看</a> 
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${item.@{crud.primaryKey}});">修改</a> 
				<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${item.@{crud.primaryKey}});">删除</a>
				</td>
				</tr>
			<% } %>
			</tbody>
		</table>
		<%include("/static/component/include/paginator.html"){} %>
	</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>